﻿using FSM.IBll;
using FSM.IDal;
using FSM.Model;
using System;
using System.Collections.Generic;
using System.Text;

namespace FSM.Bll
{
    public class TablesBll : ITablesBll
    {
        #region 模块

        private readonly ITablesDal tablesDal;

        #endregion

        #region 构造函数

        public TablesBll(ITablesDal tables_dal)
        {
            this.tablesDal = tables_dal;
        }

        #endregion

        #region 查询

        /// <summary>
        /// 获得所有的数据库信息
        /// </summary>
        /// <returns></returns>
        public List<Schemas> GetDataBases()
        {
            return tablesDal.GetDataBases();
        }

        /// <summary>
        /// 获得数据库中的所有表的信息
        /// </summary>
        /// <param name="database_name">数据库的名称</param>
        /// <returns></returns>
        public List<SchemaTables> GetTables(string database_name)
        {
            return tablesDal.GetTables(database_name);
        }

        /// <summary>
        /// 获得数据表的字段信息
        /// </summary>
        /// <param name="database_name">数据库名称</param>
        /// <param name="table_name">表名称</param>
        /// <returns></returns>
        public List<TableFields> GetFields(string database_name, string table_name)
        {
            return tablesDal.GetFields(database_name, table_name);
        }

        #endregion
    }
}
